import request from '@/utils/request'
import { getRoles } from '@/utils/auth' // get token from cookie

export function login(data, role) {
  console.log('检查信息：', data, role)
  if (role === 'USER') {
    return request({
      url: '/user/login',
      method: 'POST',
      data
    })
  }
  if (role === 'ADMIN') {
    return request({
      url: '/admin/login',
      method: 'POST',
      data
    })
  }
  if (role === 'SUPER_ADMIN') {
    return request({
      url: '/suadmin/login',
      method: 'POST',
      data
    })
  }
}
export function ceshi() {
  return request({
    url: '/reserve',
    method: 'get'
  })
}

export function getInfo(userId) {
  return request({
    url: `/user/profile/${userId}`,
    method: 'get'
  })
}

export function register(data) {
  return request({
    url: '/user/register',
    method: 'post',
    data
  })
}
